package util.webSearch;

import util.parser.DeliciousURLInfoPost;

/**
 * 
 * Encapsulates the main information of a web search result: url, snippet,title
 * 
 * @author Sergio Duarte
 * 
 */
public class WebResult {

	/**
	 * @param args
	 */

	/**
	 * Search Engine flag definition
	 * 
	 */
	public static final int BING = 2;
	public static final int GOOGLE = 1;
	public static final int YAHOO = 3;

	/**
	 * Class data
	 * 
	 */

	private String title = null;
	private Long queryId= null;
	private String url = null;
	private String query="";
	private String snippet = null;

	
	private DeliciousURLInfoPost delicious = null;
	
	public DeliciousURLInfoPost getDelicious() {
		return delicious;
	}

	public void setDelicious(DeliciousURLInfoPost delicious) {
		this.delicious = delicious;
	}

	public int getRank() {
		return rank;
	}

	public void setRank(int rank) {
		this.rank = rank;
	}

	public double getScore() {
		return score;
	}

	public void setScore(double score) {
		this.score = score;
	}

	public int getEngine() {
		return engine;
	}

	public void setEngine(int engine) {
		this.engine = engine;
	}

	private int rank = 0;
	private double score = 0;
	private int engine = 0;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getSnippet() {
		return snippet;
	}

	public void setSnippet(String snippet) {
		this.snippet = snippet;
	}

	public boolean equals(Object other) {
		return (other instanceof WebResult) && (url != null)
				&& url.equals(((WebResult) other).url);
	}

	/**
	 * The user ID is unique for each User. So User with same ID should return
	 * same hashcode.
	 * 
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return (url != null) ? (this.getClass().hashCode() + url.hashCode())
				: super.hashCode();
	}

	public long getQueryID() {
		// TODO Auto-generated method stub
		return queryId;
	}

	public Long getQueryId() {
		return queryId;
	}

	public void setQueryId(Long queryId) {
		this.queryId = queryId;
	}

	public void setQuery(String query) {
		this.query = query;
	}

	public String getQuery() {
		// TODO Auto-generated method stub
		return  query;
	}

}
